import axios from "axios";
import NProgress from "nprogress";
import "nprogress/nprogress.css"

const http = axios.create({
  baseURL: 'http://114.132.223.180:5000',
  timeout: 5000
})

// 请求拦截器
http.interceptors.request.use(config => {
  NProgress.start()
  return config
}, error => {
  return Promise.reject(error)
})

// 响应拦截器
http.interceptors.response.use(response => {
  NProgress.done()
  return response
})

export { http }